! function (e) {
    var t = {};

    function o(n) {
        if (t[n]) return t[n].exports;
        var r = t[n] = {
            i: n,
            l: !1,
            exports: {}
        };
        return e[n].call(r.exports, r, r.exports, o), r.l = !0, r.exports
    }
    o.m = e, o.c = t, o.d = function (e, t, n) {
        o.o(e, t) || Object.defineProperty(e, t, {
            enumerable: !0,
            get: n
        })
    }, o.r = function (e) {
        "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
            value: "Module"
        }), Object.defineProperty(e, "__esModule", {
            value: !0
        })
    }, o.t = function (e, t) {
        if (1 & t && (e = o(e)), 8 & t) return e;
        if (4 & t && "object" == typeof e && e && e.__esModule) return e;
        var n = Object.create(null);
        if (o.r(n), Object.defineProperty(n, "default", {
                enumerable: !0,
                value: e
            }), 2 & t && "string" != typeof e)
            for (var r in e) o.d(n, r, function (t) {
                return e[t]
            }.bind(null, r));
        return n
    }, o.n = function (e) {
        var t = e && e.__esModule ? function () {
            return e.default
        } : function () {
            return e
        };
        return o.d(t, "a", t), t
    }, o.o = function (e, t) {
        return Object.prototype.hasOwnProperty.call(e, t)
    }, o.p = ".", o(o.s = 10)
}([function (e, t) {
    e.exports = function (e) {
        return e && e.__esModule ? e : {
            default: e
        }
    }
}, function (e, t, o) {
    "use strict";
    var n = o(0)(o(0));
    Object.defineProperty(t, "__esModule", {
        value: !0
    }), t.decipher = t.cipher = t.fetch_retry = t.fetchWithTimeout = void 0;
    var r = o(2),
        a = (0, n.default)(r);

    function c(e, t) {
        var o = Object.keys(e);
        if (Object.getOwnPropertySymbols) {
            var n = Object.getOwnPropertySymbols(e);
            t && (n = n.filter((function (t) {
                return Object.getOwnPropertyDescriptor(e, t).enumerable
            }))), o.push.apply(o, n)
        }
        return o
    }

    function i(e) {
        for (var t = 1; t < arguments.length; t++) {
            var o = null != arguments[t] ? arguments[t] : {};
            t % 2 ? c(Object(o), !0).forEach((function (t) {
                (0, a.default)(e, t, o[t])
            })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(o)) : c(Object(o)).forEach((function (t) {
                Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(o, t))
            }))
        }
        return e
    }
    var l = t.fetchWithTimeout = function (e) {
        var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
            o = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 5e3,
            n = new AbortController,
            r = i({}, t, {
                signal: n.signal
            });
        setTimeout((function () {
            n.abort()
        }), o);
        return fetch(e, r).then((function (e) {
            if (!e.ok) throw new Error("".concat(e.status, ": ").concat(e.statusText));
            return e
        })).catch((function (e) {
            if ("AbortError" === e.name) throw new Error("Response timed out");
            throw new Error(e.message)
        }))
    };
    t.fetch_retry = function e(t, o, n) {
        var r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1;
        return l(t, o, n).catch((function (a) {
            if (1 === r) throw a;
            return e(t, o, n, r - 1)
        }))
    }, t.cipher = function (e) {
        var t = function (e) {
                return e.split("").map((function (e) {
                    return e.charCodeAt(0)
                }))
            },
            o = function (e) {
                return ("0" + Number(e).toString(16)).substr(-2)
            },
            n = function (o) {
                return t(e).reduce((function (e, t) {
                    return e ^ t
                }), o)
            };
        return function (e) {
            return e.split("").map(t).map(n).map(o).join("")
        }
    }, t.decipher = function (e) {
        var t = function (t) {
            return (o = e, o.split("").map((function (e) {
                return e.charCodeAt(0)
            }))).reduce((function (e, t) {
                return e ^ t
            }), t);
            var o
        };
        return function (e) {
            return e.match(/.{1,2}/g).map((function (e) {
                return parseInt(e, 16)
            })).map(t).map((function (e) {
                return String.fromCharCode(e)
            })).join("")
        }
    }
}, function (e, t) {
    e.exports = function (e, t, o) {
        return t in e ? Object.defineProperty(e, t, {
            value: o,
            enumerable: !0,
            configurable: !0,
            writable: !0
        }) : e[t] = o, e
    }
}, function (e, t, o) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }), t.DISABLE_DOWNLOADING_FROM_YOUTUBE_REGEXP = t.supportedLanguages = t.t = t.PRE_DEF_EXTS = t.YTDLPAGE = t.HOMEPAGE = t.ISEDGE = t.PROENV = void 0, t.doInit = function () {
        if (void 0 === localStorage[c] || "" == localStorage[c]) {
            var e = new Array({
                ext: "flv",
                size: 10
            }, {
                ext: "hlv",
                size: 10
            }, {
                ext: "f4v",
                size: 10
            }, {
                ext: "mp4",
                size: 10
            }, {
                ext: "mp3",
                size: 10
            }, {
                ext: "wma",
                size: 10
            }, {
                ext: "wav",
                size: 10
            }, {
                ext: "m4a",
                size: 10
            }, {
                ext: "webm",
                size: 10
            }, {
                ext: "ogg",
                size: 10
            }, {
                ext: "ogv",
                size: 10
            }, {
                ext: "acc",
                size: 10
            }, {
                ext: "mov",
                size: 10
            }, {
                ext: "mkv",
                size: 10
            }, {
                ext: "m3u8",
                size: 0
            }, {
                ext: "ts",
                size: 1e11
            });
            localStorage[c] = JSON.stringify(e)
        }
        if (void 0 === localStorage.Type) {
            var t = new Array({
                Type: "video/*",
                size: 2048
            }, {
                Type: "audio/*",
                size: 10
            });
            localStorage.Type = JSON.stringify(t)
        }
        if (void 0 === localStorage.BlockedDomains) {
            var o = new Array;
            localStorage.BlockedDomains = JSON.stringify(o)
        }
        void 0 === localStorage.repeat && (localStorage.repeat = !1);
        void 0 === localStorage.repeatReg && (localStorage.repeatReg = "\\?[\\S]+");
        void 0 === localStorage.Debug && (localStorage.Debug = !1);
        void 0 === localStorage.TitleName && (localStorage.TitleName = !1);
        void 0 === localStorage.popListCount && (localStorage.popListCount = 30);
        void 0 === localStorage.showCountOnIcon && (localStorage.showCountOnIcon = !0)
    }, t.tr = function (e) {
        $("#" + e).html(i(e))
    }, t.getLanguage = s, t.getExtManifest = function () {
        return r.runtime.getManifest()
    }, t.isActivePro = p, t.getLoaderUrl = function () {
        var e, t, o = s(),
            n = "://www.cnbbx.com/";
        e = "other" != o ? "hls.html" : "ohls.html";
        p() && (n = "://www.cnbbx.com/", e = "hls.vhtml", "other" == o && (e = "ohls.vhtml"));
        t = a ? n + (l.includes(o) ? o + "/" : "") + e : "://127.0.0.1/" + e;
        return t
    }, t.getDLMUrl = function () {
        var e, t, o = s(),
            n = "://www.cnbbx.com/";
        e = "other" != o ? "dlm.html" : "odlm.html";
        p() && (n = "://www.cnbbx.com/", e = "dlm.vhtml", "other" == o && (e = "odlm.vhtml"));
        t = a ? n + "dlm/" + (l.includes(o) ? o + "/" : "") + e : "://127.0.0.1/dlm/" + e;
        return t
    };
    var n = o(1),
        r = navigator.userAgent.includes("Chrome") ? chrome : browser,
        a = t.PROENV = !0;
    t.ISEDGE = !1, t.HOMEPAGE = void 0, t.YTDLPAGE = void 0;
    a ? (t.HOMEPAGE = "https://www.cnbbx.com", t.YTDLPAGE = "https://www.cnbbx.com/yt/") : (console.log("dev env"), t.HOMEPAGE = "http://127.0.0.1", t.YTDLPAGE = "http://127.0.0.1");
    var c = t.PRE_DEF_EXTS = "Ext04";
    r.browserAction.setIcon({
        path: {
            16: "assets/icons/16x16_gray.png",
            32: "assets/icons/32x32_gray.png",
            48: "assets/icons/48x48_gray.png",
            64: "assets/icons/64x64_gray.png",
            128: "assets/icons/128x128_gray.png"
        }
    });
    var i = t.t = r.i18n.getMessage;
    var l = t.supportedLanguages = ["zh_tw", "zh_cn"];

    function s() {
        var e = r.i18n.getUILanguage();
        return e.match(/zh-CN/) ? "zh_cn" : e.match(/zh-TW/) ? "zh_tw" : e.startsWith("zh") ? "zh_cn" : e.startsWith("en") ? e.substr(0, 2) : "other"
    }
    if (r.runtime.onInstalled.addListener((function (e) {
            var t = s(),
                o = "https://www.cnbbx.com/" + (l.includes(t) ? t + "/" : "") + "installed.html";
            localStorage.getItem("installed") || r.tabs.create({
                url: o
            }, (function (e) {
                console.log("Hi, wellcome:)"), localStorage.setItem("installed", "t")
            }))
        })), r.runtime.setUninstallURL) {
        var u = s(),
            d = "https://www.cnbbx.com/" + (l.includes(u) ? u + "/" : "") + "uninstalled.html";
        r.runtime.setUninstallURL(d)
    }
    t.DISABLE_DOWNLOADING_FROM_YOUTUBE_REGEXP = /^https?:\/\/www\.youtube\.com\//;

    function p() {
        if (localStorage.getItem("pui") && "active" == (0, n.decipher)("CocoCut pro user")(localStorage.getItem("pui")).split("|")[3]) return !0;
        return !1
    }
}, , , , , function (e, t, o) {}, , function (e, t, o) {
    "use strict";
    o(8);
    var n = o(3);
    (0, n.doInit)(),
    function () {
        for (var e = 0, t = ["TcustomTypeIgn", "TcustomSetting", "TcustomExt", "TcustomExtDec", "TcustomExtName", "TcustomExtSize", "TcustomAdd", "TcustomCtDec", "TcustomCtMIME", "TcustomOt", "TcustomOtIgnore", "TcustomOtIgnoreDec", "TcustomOtReg", "TcustomOtFilename", "TcustomDebug", "ResetExt", "SaveExt", "modalOkBtn", "modalCancelBtn", "TcustomAddMine", "importSettingsOkBtn", "importSettingsCancelBtn", "importSettingsWarning", "importSettingsFilelabel", "importSettingsFilename", "exportSettingBtn", "importSettingBtn", "customNavIEbtns", "TcustomBlockedDomains", "TcustomBlockedDomainsDec", "TcustomBlockedDomainExample", "TcustomMaxDisplayCount", "TcustomShowCountOnIcon"]; e < t.length; e++) {
            var o = t[e];
            (0, n.tr)(o)
        }
    }();
    var r = new Array;
    r = JSON.parse(localStorage[n.PRE_DEF_EXTS]);
    for (var a = 0; a < r.length; a++) $("#ExtTd").append(l(r[a].ext, r[a].size));
    var c = new Array;
    c = JSON.parse(localStorage.Type);
    for (a = 0; a < c.length; a++) $("#ExtTy").append(s(c[a].Type, c[a].size));
    var i = new Array;
    i = JSON.parse(localStorage.BlockedDomains);
    for (a = 0; a < i.length; a++) $("#blockedDomainsTd").append(u(i[a]));

    function l() {
        var e = arguments[0] ? arguments[0] : "",
            t = arguments[1] ? arguments[1] : "0";
        return '<tr><td><input type="text" class="ext input" placeholder="' + (0, n.t)("TcustomExtName") + '" value="' + e + '"></td><td class="TdSize"><input type="text" class="size input" placeholder="' + (0, n.t)("TcustomExtSize") + '" value="' + t + '"></td><td class="SizeButton">kb</td><td id="RemoveExt" class="RemoveButton"><a class="delete"></a></td></tr>'
    }

    function s() {
        var e = arguments[0] ? arguments[0] : "",
            t = arguments[1] ? arguments[1] : "0";
        return '<tr><td><input type="text" class="Type input" placeholder="' + (0, n.t)("TcustomCtMIME") + '" value="' + e + '"></td><td class="TdSize"><input type="text" class="size input" placeholder="' + (0, n.t)("TcustomExtSize") + '" value="' + t + '"></td><td class="SizeButton">kb</td><td id="RemoveType" class="RemoveButton"><a class="delete"></a></td></tr>'
    }

    function u() {
        var e = arguments[0] ? arguments[0] : "";
        return '<tr><td><input type="text" class="blockedDomain input" placeholder="' + (0, n.t)("TcustomBlockedDomainPlaceholder") + '" value="' + e + '"></td><td id="RemoveBlockedDomain" class="RemoveButton"><a class="delete"></a></td></tr>'
    }

    function d(e, t) {
        $("#confMsg").addClass("is-active"), $("html").addClass("is-clipped"), $("#TempntcText").html(e), t && ($("#modalCancelBtn").show(), $("#modalOkBtn").addClass("comfirmDoit"))
    }

    function p() {
        $("#confMsg").removeClass("is-active"), $("html").removeClass("is-clipped"), $("#modalCancelBtn").hide()
    }
    "true" == localStorage.repeat && $("#repeat").attr("checked", "checked"), $("#repeatReg").val(localStorage.repeatReg), "true" == localStorage.Debug && $("#Debug").attr("checked", "checked"), "true" == localStorage.TitleName && $("#TitleName").attr("checked", "checked"), "true" == localStorage.showCountOnIcon && $("#showCountOnIcon").attr("checked", "checked"), $("#MaxDisplayCount").attr("value", localStorage.popListCount), $("#AddExt").bind("click", (function () {
        $("#ExtTd").prepend(l()), $("#RemoveExt*").bind("click", (function () {
            $(this).parent().remove()
        }))
    })), $("#AddType").bind("click", (function () {
        $("#ExtTy").prepend(s()), $("#RemoveType*").bind("click", (function () {
            $(this).parent().remove()
        }))
    })), $("#AddBlockedDomain").bind("click", (function () {
        $("#blockedDomainsTd").prepend(u()), $("#RemoveBlockedDomain*").bind("click", (function () {
            $(this).parent().remove()
        }))
    })), $("#modalOkBtn").click((function () {
        p()
    })), $("#modalCancelBtn").click((function () {
        p()
    })), $("#RemoveExt*").bind("click", (function () {
        $(this).parent().remove()
    })), $("#RemoveType*").bind("click", (function () {
        $(this).parent().remove()
    })), $("#RemoveBlockedDomain*").bind("click", (function () {
        $(this).parent().remove()
    })), $("#SaveExt").bind("click", (function () {
        var e = new Array,
            t = new Array,
            o = new Array,
            r = !0;
        $("#ExtTd tr").each((function (e) {
            var o = $(this).find(".ext").val();
            if (null == o || null == o || "" == o) return d((0, n.t)("TcustomExtNameEmpty")), r = !1, !1;
            var a = $(this).find(".size").val();
            null != a && null != a && "" != a || (a = 0, $(this).find(".size").val("0")), t[e] = {
                ext: o,
                size: a
            }
        })), $("#ExtTy tr").each((function (t) {
            var o = $(this).find(".Type").val();
            if (null == o || null == o || "" == o) return d((0, n.t)("TcustomMineEmpty")), r = !1, !1;
            var a = $(this).find(".size").val();
            null != a && null != a && "" != a || (a = 0, $(this).find(".size").val("0")), e[t] = {
                Type: o,
                size: a
            }
        })), $("#blockedDomainsTd tr").each((function (e) {
            var t = $(this).find(".blockedDomain").val();
            if (null == t || null == t || "" == t) return d((0, n.t)("TcustomBlockedDomainEmpty")), r = !1, !1;
            o[e] = t
        })), r && (localStorage[n.PRE_DEF_EXTS] = JSON.stringify(t), localStorage.Type = JSON.stringify(e), localStorage.BlockedDomains = JSON.stringify(o), d((0, n.t)("TcustomSaved"))), localStorage.repeatReg = $("#repeatReg").val(), localStorage.popListCount = $("#MaxDisplayCount").val()
    })), $("#repeat").bind("click", (function () {
        $(this).prop("checked") ? ($("#repeat").attr("checked", "true"), localStorage.repeat = !0) : ($("#repeat").removeAttr("checked"), localStorage.repeat = !1)
    })), $("#Debug").bind("click", (function () {
        $(this).prop("checked") ? ($("#Debug").attr("checked", "true"), localStorage.Debug = !0) : ($("#Debug").removeAttr("checked"), localStorage.Debug = !1)
    })), $("#TitleName").bind("click", (function () {
        $(this).prop("checked") ? ($("#TitleName").attr("checked", "true"), localStorage.TitleName = !0) : ($("#TitleName").removeAttr("checked"), localStorage.TitleName = !1)
    })), $("#showCountOnIcon").bind("click", (function () {
        $(this).prop("checked") ? ($("#showCountOnIcon").attr("checked", "true"), localStorage.showCountOnIcon = !0) : ($("#showCountOnIcon").removeAttr("checked"), localStorage.showCountOnIcon = !1)
    })), $("#ResetExt").click((function () {
        d((0, n.t)("TcustomComfirmRest"), !0), $(".comfirmDoit").bind("click", (function (e) {
            e.preventDefault(), delete localStorage[n.PRE_DEF_EXTS], delete localStorage.repeatReg, delete localStorage.repeat, delete localStorage.Debug, delete localStorage.Type, delete localStorage.TitleName, delete localStorage.showCountOnIcon, delete localStorage.popListCount, delete localStorage.BlockedDomains, location.reload()
        }))
    })), $("#exportSettingBtn").click((function () {
        var e = {
            Type: JSON.parse(localStorage.Type),
            BlockedDomains: JSON.parse(localStorage.BlockedDomains)
        };
        e[n.PRE_DEF_EXTS] = JSON.parse(localStorage[n.PRE_DEF_EXTS]), e.repeatReg = localStorage.repeatReg, e.Debug = localStorage.Debug, e.TitleName = localStorage.TitleName, e.popListCount = localStorage.popListCount, e.showCountOnIcon = localStorage.showCountOnIcon, e.repeat = localStorage.repeat;
        var t = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(e)),
            o = document.getElementById("settingDownloadAnchorElem");
        o.setAttribute("href", t), o.setAttribute("download", "cococutSettings.json"), o.click()
    })), $("#importSettingBtn").click((function () {
        function e() {
            $("#importSettingsModal").removeClass("is-active"), $("html").removeClass("is-clipped"), $("#importSettingsCancelBtn").hide()
        }
        $("#importSettingsModal").addClass("is-active"), $("html").addClass("is-clipped"), $("#importSettingsCancelBtn").show(), $("#importSettingsOkBtn").addClass("comfirmDoit"), $("#importSettingsOkBtn").click((function () {
            ! function () {
                var e = t.files[0];
                if (e) {
                    var o = new FileReader;
                    o.readAsText(e, "UTF-8"), o.onload = function (e) {
                        ! function (e) {
                            try {
                                var t = JSON.parse(e);
                                localStorage.Type = JSON.stringify(t.Type), localStorage.repeat = t.repeat, localStorage.repeatReg = t.repeatReg, localStorage.Debug = t.Debug, localStorage.TitleName = t.TitleName, localStorage.showCountOnIcon = t.showCountOnIcon, localStorage.popListCount = t.popListCount, localStorage[n.PRE_DEF_EXTS] = JSON.stringify(t[n.PRE_DEF_EXTS]), localStorage.BlockedDomains = JSON.stringify(t.BlockedDomains), location.reload()
                            } catch (e) {
                                alert("Import settings error, error message is:" + e)
                            }
                        }(e.target.result)
                    }, o.onerror = function (e) {
                        console.log("error reading file")
                    }
                }
            }(), e()
        })), $("#importSettingsCancelBtn").click((function () {
            e()
        }));
        var t = document.querySelector("#importSettingsFile input[type=file]");
        t.onchange = function () {
            t.files.length > 0 && (document.querySelector("#importSettingsFile .file-name").textContent = t.files[0].name)
        }
    }))
}]);